{include file="header"}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card-header">
                <div class="left">
                    <button class="layui-btn layui-btn-primary addline" onclick="xadmin.open('人员添加','{:url("personnel/add")}',600,600)">新建人员</button>
                    <button class="layui-btn layui-btn-primary selobj" onclick="sel()" data-type="sel">选择对象</button>
                    <button class="layui-btn layui-btn-danger del" onclick="del()">删除</button>
                </div>
                <div class="right">
                    <form action="{:url('personnel/index')}" method="get" class="layui-form layui-col-space5 hide">
                        <div class="layui-inline layui-show-xs-block">

                            <input type="text" class="layui-input" name="title" value="{:request()->get('title')}" placeholder="输入要找的特定作品">
                        </div>
                        <div class="layui-inline layui-show-xs-block">

                            <input type="text" class="layui-input" name="keyword" value="{:request()->get('keyword')}" placeholder="输入要找的人员名称">
                        </div>
                        <div class="layui-inline layui-show-xs-block">

                            <button class="layui-btn" type="submit">搜索</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card-header">
                总 <span class="x-red">{$lists->total()}</span> 条搜索结果
            </div>
            <div class="layui-card-body">
                <table class="layui-table layui-form">
                    <thead>
                    <tr>
                        <th rowspan="2" width="80"></th>
                        <th rowspan="2">人名</th>
                        <th rowspan="2">身份</th>
                        <th rowspan="2">生日</th>
                        <th rowspan="2">所属公司</th>
                        <th colspan="3">名字形式</th>
                    </tr>
                    <tr>
                        <th>日文汉字</th>
                        <th>平假名</th>
                        <th>罗马字</th>
                    </tr>
                    </thead>
                    {volist name="lists" id="item"}
                    <tbody>
                    <tr class="tr_{$item.id}">
                        <td rowspan="2">
                            <a href="javascript:;" class="editbtn" onclick="xadmin.open('人员修改','{:url("personnel/edit",["id"=>$item["id"]])}',600,600)">编辑</a>
                            <div style="display: none;" class="selone">
                                <input type="checkbox" name="selone" value="{$item.id}" lay-filter="selone" lay-skin="primary" >
                            </div>

                        </td>
                        <td rowspan="2">{$item.uname}</td>
                        <td rowspan="2">{$item.idcard_name}</td>
                        <td rowspan="2">{$item.birthday}</td>
                        <td rowspan="2">{$item.company_name}</td>
                    </tr>
                    <tr class="tr_{$item.id}">
                        <td rowspan="2">{$item.jp_ch}</td>
                        <td rowspan="2">{$item.jp_jp}</td>
                        <td rowspan="2">{$item.jp_lm}</td>
                    </tr>
                    </tbody>
                    {/volist}
                </table>

            </div>
            <div class="layui-card-body ">
                {$lists|raw}
            </div>
        </div>
    </div>
</div>
<script>
    function del() {
        var id;
        let seltype = $('.selobj').data("type")
        if(seltype==="sel"){
            id = [$('[name="selone"]').last().val()]
        }else{
            id = getselall()
        }

        layer.confirm("{:lang('del.confirm')}",{icon: 3, title:'{:lang("tips")}'},function (index) {
            layer.close(index);
            request("POST",'{:url("personnel/del")}',{
                id:id
            },function (res) {
                for(let i in id){
                    $(`.tr_${id[i]}`).remove()
                }

            })

        })
    }
</script>
{include file="footer"}